package com.itheima.method;


import java.util.Scanner;

public class Test01 {
    public static void main(String[] args) {
        add(7);
    }

    public static void add(int a) {
        //键盘录入
        Scanner sc = new Scanner(System.in);
        //用户提示
        System.out.println("请输入几个数相加");
        //键入变量接收
        int num = sc.nextInt();
        //创建一个数组arr
        int[] arr = new int[num];
        arr[0] = a;
        for (int i = 1; i < num; i++) {
            arr[i] = arr[i - 1] * 10 + a;
        }
        //数组求和
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            sum += arr[i];
        }
        System.out.println(sum);
    }


}
